from django.db import models

# Create your models here.


class Subject(models.Model):
    subject_text = models.CharField(max_length = 200)


    def __str__(self):
        return self.subject_text



class QuestionType(models.Model):
    subject = models.ForeignKey(Subject, on_delete = models.CASCADE)
    question_type_text = models.CharField(max_length = 200)
    
    def __str__(self):
        return self.question_type_text


class Question(models.Model):
    question_type = models.ForeignKey(QuestionType, on_delete = models.CASCADE)
    question_text = models.CharField(max_length = 1000,unique = True)
    answer_text = models.TextField()
    pub_date = models.DateTimeField(auto_now = True)

    def __str__(self):
        return self.question_text


class Choice(models.Model):
    question = models.ForeignKey(Question, on_delete = models.CASCADE)
    choice_text = models.CharField(max_length = 200)

    def __str__(self):
        return self.choice_text




